                <div class="search">
                	<div class="box_style01 clearfix">
                        <div class="box_style_top">
                            <p><img src="<?php echo IMAGE_URL?>bg_left_top01.gif" alt="" /></p>
                        </div>
                        <div class="box_style_inner">
                            <div class="box_style_content clearfix">
                               <h3 class="sh_line"><span>TÌM KIẾM XE</span></h3>
                               <form method="get" name="search" action="/search/">
                               <ul class="search_list">
                               		<li class="clearfix" id="typesearch" style="float: left;">
                                    	<input type="radio" id="moto" name="type" value="0" <?php if($this->TYPE==0) echo "checked='checked'";?> /><label for="moto">Xe máy</label>
                                        <input type="radio" id="oto" name="type" value="1" <?php if($this->TYPE==1) echo "checked='checked'";?>/><label for="oto">Ôtô</label>
                                    </li>
                                    <br clear="all" />
                                    <li class="clearfix">
                                    	<select id="manufacture" name="manufacture">
                                            <option value="">--Chọn thương hiệu--</option>
                                        	<?php echo $this->HTML_FACTORY ?>
                                        </select>
                                        
                                        <select id="model" class="<?php if($this->TYPE==1) echo 'otow' ?>" name="model">
                                        	<option value="">--Chọn model--</option>
                                            <?php echo $this->HTML_MODEL ?>
                                        </select>
                                        <select id="style" class="otow" style="display:<?php if($this->TYPE==1)echo 'block;';else echo 'none' ?>" name="style">
                                        	<option value="">--Chọn dòng xe--</option>
                                            <?php echo $this->HTML_STYLE ?>
                                        </select>                                     
                                    </li>
                                    
                                    <li class="clearfix">
                                    	<select id="city" name="city">
                                        	<option value="">--Chọn thành phố--</option>
                                            <?php echo $this->HTML_CITY ?>
                                        </select>
                                        
                                        <select id="price" name="price">
                                        	<option value="">--Giá--</option>
                                            <?php echo $this->sHTML_PRICE ?>
                                        </select>
                                    </li>
                               </ul>

                               <p class="submit_btn"><a href="javascript:void(0);" class="click_btn" onclick="actionSearch();"><span>Tìm</span></a></p>
                               </form>
                            </div>
                        </div>
                        <div class="box_style_bottom">
                            <p><img src="<?php echo IMAGE_URL?>bg_left_bottom01.gif" alt="" /></p>
                        </div>
                    </div>
                    <div class="search_block" id="loading">
                        <div class="box_style02 clearfix">
                            <div class="box_style_content clearfix" style="height: 125px; cursor: wait; background: none;">&nbsp;
                            </div>
                        </div>
                    </div>
                </div>
<style>                
    .otow{
        width: 131px !important;
    }
</style>                    
<script language="javascript" type="text/javascript">
    function showLoading(){
        $('.contentInner').show();
    }
    function hideLoading(){
        $('.contentInner').hide();
    }    
    $('#typesearch').click(function(){
        showLoading();
	    var checked= $("input:checked").val();
        if (checked == type) {
            hideLoading();
            return;
        }
        type = checked;
        if(checked==1){
            $('#model').addClass('otow');
            $('#style').show();
            $('#style').attr('disabled',false);
        }else{
            $('#model').removeClass('otow');
            $('#style').hide();
            $('#style').attr('disabled',true);
        }
		$.post('/ajax/get-manufacture',{type:checked},function(resp){
			if(isNaN(resp)){
				$('#manufacture').html(resp);
                //hideLoading();
			}
        });
        $.post('/ajax/get-model',{type:checked},function(resp2){
			if(isNaN(resp2)){
				$('#model').html(resp2);
                //hideLoading();
			}
        });
        $.post('/ajax/get-price',{type:checked},function(resp2){
			if(isNaN(resp2)){
				$('#price').html(resp2);
                //hideLoading();
			}
        });
        hideLoading();
    });
    $('#manufacture').change(function(){
        showLoading();
        var checked= $("input:checked").val();
        var manu_id=$('#manufacture').val();
        $.post('/ajax/get-model',{type:checked,manu_id:manu_id},function(resp){
			if(isNaN(resp)){
				$('#model').html(resp);
                hideLoading();
			}
        });
    })
    function callModel(id){
        showLoading();
        
        var manu_id=$('#company0'+id).val();
        $.post('/ajax/get-model',{type:type,manu_id:manu_id},function(resp){
			if(isNaN(resp)){
				$('#model0'+id).html(resp);
                hideLoading();
			}
        });
    }
    function actionSearch(){
        
        var type = 0;
        var str = '/<?php echo $this->translate('by_type_0')?>';
        if (document.search.type[1].checked){
            type =1;
            str = '/<?php echo $this->translate('by_type_1')?>';
        }
        
        
        var manufacture = document.search.manufacture.value;
        var model = document.search.model.value;
        var style = document.search.style.value;
        var city = document.search.city.value;
        
        var price = document.search.price.value;        
        
        var url = '/search/index/type/'+type;
        var link = '';
        if (manufacture!='') link = link+'/manufacture/' +manufacture;
        if (model!='') link = link+'/model/' +model;
        if (style!='') link = link+'/style/' +style;
        if (city!='') link = link+'/city/' +city;
        if (price!='') link = link+'/price/' +price;
        
        if (link==''){
            window.location = str; 
        }else{
            window.location = url + link; 
        }
          
        return false; 
    }
</script>                 